from django.db import models
import uuid
from app.models import Root
from acticle.models import ActicleType

#菜单表
class NavTree(models.Model):
    id = models.UUIDField(primary_key=True,default = uuid.uuid1)
    nav_name = models.TextField(max_length=15)
    navType = models.ForeignKey(ActicleType,on_delete=models.CASCADE)

    def __str__(self):
        return "<NavTree:id s,nav_name=%s>"\
            %(self.id,self.nav_name)

#菜单权限表
class NavTreeRoot(models.Model):
    id = models.UUIDField(primary_key=True,default = uuid.uuid1)
    navTree = models.ForeignKey(NavTree,on_delete=models.CASCADE)
    root = models.ForeignKey(Root,on_delete=models.CASCADE)

    def __str__(self):
        return "<NavTreeRoot:id=%s>"\
            %(self.id)
    